package com.antu.first.enums;

/**
 * 评论操作的枚举类
 * Created by 姚江 on 2018/3/6.
 */
public enum CommentStateEnum {

    SUCCESS(1,"执行成功"),ERROR(-1,"执行失败"),EMPTY_CONTENT(2,"评论内容为空"),OFFLINE(3,"您已掉线，请重新登录"),
    IS_LAST_PAGE(4,"已经是最后一页了！"),EMPTY_LIST(5,"目前没有评论信息"),FAILED(101,"评论失败"),
    COMMENT_SUCCESS(6,"评论成功！");

    private int state;

    private String stateInfo;

    CommentStateEnum(int state, String stateInfo) {
        this.state = state;
        this.stateInfo = stateInfo;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getStateInfo() {
        return stateInfo;
    }

    public void setStateInfo(String stateInfo) {
        this.stateInfo = stateInfo;
    }

    public static CommentStateEnum valueOf(int key){
        for (CommentStateEnum stateEnum : values()){
            if (stateEnum.getState() == key) {
                return stateEnum;
            }
        }
        return null;
    }
}
